feat: Gemini Interactions API record/replay (issue #136)#139
Conversation
commit: |
9ef4bd4 to
01c1bc3
Compare
|
Tried wiring this into TanStack AI's E2E suite (uses Root cause
interface Turn {
role?: string
content?: string | Array<Content_2>
}— the field is Repro (your PR's aimock + a single fixture matching
|
New handler for Google's stateful conversation endpoint (POST /v1beta/interactions). Supports string, Turn[], and Content[] input with content/parts and result/output backwards compatibility. Full streaming with data-only SSE format, stream collapse, chaos testing, interruption, and recorder integration. 12th LLM provider.
63 tests covering input conversion, response builders, SSE streaming, stream collapse, fixture matching, SDK wire-format conformance (content over parts, result over output), and unrecognized response fallback.
Dedicated docs page with request format, fixture matching, SSE events, recording, and TanStack AI integration. Provider count updated 11 to 12 across README, migration guides, and competitive matrix.
Register gemini-interactions provider in drift-report-collector and fix-drift scripts for automated SDK shape monitoring.
b26cff1 to
be60203
Compare
|
@tombeckenham Back to you sir. LMK. |
|
Confirmed working — pulled Both turns work: the official LGTM from the consumer side — happy to ship. |
…lity (#151) ## Summary - **Drift tests**: All 4 Gemini Interactions drift tests now wrap real API calls in try/catch. When the API returns HTTP errors (404, 5xx), the test warns and passes instead of crashing with an unparseable failure message. - **Drift collector**: The `collectDriftEntries` guard now distinguishes infrastructure failures (HTTP errors, connection refused) from broken report formats. API unavailability warns instead of crashing; actual format mismatches still crash. Fixes the drift job failure introduced by PR #139 (Gemini Interactions API). ## Test plan - [x] 2718 tests pass - [x] tsc clean
Summary
Adds full record/replay support for Google's Gemini Interactions API (
POST /v1beta/interactions), the stateful conversation endpoint used by TanStack AI'sgeminiTextInteractions()adapter. 12th LLM provider.src/gemini-interactions.ts): request conversion, response builders, SSE stream writer with data-only format, multi-turn sequencing viaprevious_interaction_idcontentoverparts(Turn field) andresultoveroutput(function_result field), matching the official@google/genaiSDK types with backwards-compat fallbackbuildFixtureResponseInteractions detection + stream collapseCloses #136
Test plan
pnpm test— 2682 passed, 36 skipped, 0 failedpnpm run format:check— cleanpnpm run lint— cleannpx tsc --noEmit— clean